#!/bin/bash

logfile=/var/log/warcprox.log
touch $logfile
chown {{user}} $logfile

ulimit -n 4096

cd {{work_dir}}

source {{venv_root}}/warcprox-ve3/bin/activate

exec nice -n5 setuidgid {{user}} env LANG=en_US.UTF-8 LC_COLLATE=C warcprox \
         --address=0.0.0.0 \
         --dir={{warcs_dir}} \
         --base32 \
         --gzip \
         --rollover-idle-time=180 \
         --onion-tor-socks-proxy=localhost:9050 \
         --rethinkdb-services-url=rethinkdb://{{groups['rethinkdb']|join(',')}}/brozzler/services \
         --rethinkdb-stats-url=rethinkdb://{{groups['rethinkdb']|join(',')}}/brozzler/stats \
         --rethinkdb-big-table-url=rethinkdb://{{groups['rethinkdb']|join(',')}}/brozzler/captures \
         >> $logfile 2>&1

